var __is_ff=(navigator.userAgent.indexOf("Firefox") != -1);// Firefox

//事件获取
function getEvent() {
	if (document.all)
		return window.event;
	func = getEvent.caller;
	while (func != null) {
		var arg0 = func.arguments[0];
		if (arg0) {
			if ((arg0.constructor == Event || arg0.constructor == MouseEvent)
					|| (typeof (arg0) == "object" && arg0.preventDefault && arg0.stopPropagation)) {
				return arg0;
			}
		}
		func = func.caller;
	}
	return null;
}

//鼠标位置
function getMouseLocation(){
	e = getEvent();
	var mouseX = 0;
	if (__is_ff) {
		mouseX = e.layerX - document.getElementById('pic').offsetLeft+document.body.scrollLeft;
	}else{
		mouseX=e.offsetX + document.body.scrollLeft;
	}
	return mouseX;
}


//点击图片跳转
function click_pic(o) {	
	var offset_x=getMouseLocation();
	if(offset_x<=o.clientWidth/2){
		mh.prevPage();
	}else{
		if(typeof next_page_flag != 'undefined'){
			showIframe(iframesrc);
			return false;
		}
		mh.nextPage();
	}
        return false;
}

//鼠标停留在图片上时，样子的转换
function change_style(o) {
	var offset_x = getMouseLocation();
	if (offset_x <= o.clientWidth / 2) {
		if (!o.style.cursor.match("pre")) {
			o.style.cursor = 'url("/images/read/pre.cur"), pointer';// "NW-resize";
		}
	} else if (!o.style.cursor.match("next")) {
    o.style.cursor = 'url("/images/read/next.cur"), pointer';
	}
	return;
}

//这个函数需要thinkbox
function showIframe(iframesrc){
	tb_show(null, iframesrc);
}